﻿<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="../include/head.jspf"%>   
<title>东方易云后台管理系统</title>
<style>
body { background: #f5f5f5 ;}
</style>
<link rel="stylesheet" href="resource/css/jquery-ui.css" type="text/css"  />
<script type="text/javascript" src="resource/js/jquery-ui.js"></script>
<script>
function addCompanyFlow(){
		var flowTemplateId=$('#flowTemplateId').val();
		var	flowName=$('#flowName').val();
		var	originateCop=$('#originateCop').val();
		if(flowTemplateId.length>0){
			if(flowName.length==0){
				alert("请填写业务流程名称");
				return;	
			}
			if(originateCop.length==0){
				alert("请填发起单位平台编号");
				return;	
			}
			var vTotal=$('#listSize').val();
			if(vTotal>0){
				for(var i=1;i<=vTotal;i++){
					if($('#'+i).val().length==0){
						alert("请填写企业平台编号");
						return;
					}
					if($('#serviceCode_'+i).val().length==0){
						alert("请选择服务类型");
						return;
					}
				}
			}
			$('#addForm').submit();
		}else{
			alert("请选择公共模板编号");				
		}
}
function fillflowAtcor(ob,v){
	var ecCode=v;
	var id=ob.attr("id");
	$('#serviceCode_'+id).empty();
	$('#ceName_'+id).empty();
	if(ecCode.length>0){
		var data = getDataByAjax("services/dataxFlow/getEnterpriseServiceType",{ "fiId": ecCode});
			if(data.flag){
				$('#ceName_'+id).append(data.vwDataxEnterpriseVO.ecName);	
				$('#serviceCode_'+id).append(data.option);	
			}else{
				ob.val("");
			}
	}
}
$(document).ready(function(){
	$('#flowTemplateId').change(function() {
			var flowTemplateId=$('#flowTemplateId').val();
			if(flowTemplateId.length>0){
				$('#flowTempIdSelect').val(flowTemplateId);
				$('#addForm').attr("action","showFlowTempInfo");
					$('#addForm').submit();
			}
	});
	$(".ecCodeInput").autocomplete({source:"services/dataxFlow/getEnterpriseCode?originateCop="+$(this).val(),select: function(e,ui){
		fillflowAtcor($(this),ui.item.value);
	}});
	$('.ecCodeInput').change(function(){fillflowAtcor($(this),$(this).val());});
	$("#originateCop").autocomplete({source:"services/dataxFlow/getEnterpriseCode"+$(this).val()});

});
</script>
<!--[if lt IE 7.]>
<script defer type="text/javascript" src="js/pngfix.js"></script>
<![endif]-->
</head>
<body>
<form method="post" action="showFlowTempInfo" id="selectForm">

</form>
<form method="post" action="companyFlowAddSubmit" id="addForm">
<input type="hidden" name="pageNo" value="<c:out value='${pageNo}' />"/>
<input type="hidden" name="flowIdSelect" value="<c:out value='${flowIdSelect }' />"/>
<input type="hidden" name="originateCopSelect" value="<c:out value='${originateCopSelect}' />"/>
<input type="hidden" name="eNameSelect" value="<c:out value='${eNameSelect}' />"/>
<input type="hidden" id="statusSelect" name="statusSelect" value="<c:out value='${statusSelect }' />">
<input type="hidden" name="flowTempIdSelect" id="flowTempIdSelect" value="<c:out value='${flowTempIdSelect }' />"/>
<div id="body-wrapper">

  <!-- Wrapper for the radial gradient background -->
  <div id="main-content">
    <!-- Main Content Section with everything -->
    <!-- Page Head -->
    <div id="page-title">
      <h3>企业业务流程新建</h3>
    </div>
    <div class="pgline"></div>

    <div class="bulk-actions align-left"> <a class="button2" href="javascript:void(0);" onclick="addCompanyFlow();">保存</a> </div>
    <div class="clear"></div>
    

    <div id="page-title">
      <h4>业务流程基本信息</h4>
    </div>
    <div class="pgline"></div>
    <div class="clear"></div>

    <div class="bulk-actions align-left"> </div>
    <div class="clear"></div>
    <div class="notification querytj png_bg">
      <div>
        <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
          <tr>
            <td width="13%" height="35" align="right">&nbsp;&nbsp;公共模板编号： </td>

            <td width="29%"><select name="id.flowTemplateId" id="flowTemplateId" class="select1" >
             <c:if test="${!isSelect}" >
             	<option value="" selected="selected">请选择</option>
             </c:if>
              <c:forEach items="${optionFlowTemplate}" var="one">
              	 	<c:choose>
	   					<c:when test="${dataxFlowTemplateVO.flowTemplateId==one.flowTemplateId}">
	   						<option value="<c:out value="${one.flowTemplateId}"/>" selected="selected"><c:out value="${one.flowTemplateId}"/></option>
	   					</c:when>
	   					<c:otherwise> <option value="<c:out value="${one.flowTemplateId}"/>"><c:out value="${one.flowTemplateId}"/></option></c:otherwise>
	   				</c:choose>
	             
	          </c:forEach>
	          
            </select></td>
            <td width="15%" align="right">公共模板名称： </td>
            <td width="26%"><input name="flowTemplateName" id="flowTemplateName"  value="<c:out value="${dataxFlowTemplateVO.flowTemplateName}"/>" type="text"  class="input21" readonly="readonly" /></td>
          </tr>
          <tr>
            <td height="35" align="right">&nbsp;&nbsp;业务类型： </td>

            <td height="35"><input name="businessType" id="businessType" value="<c:out value="${dataxFlowTemplateVO.businessType}"/>" type="text"  class="input21" readonly="readonly" /></td>
            <td width="15%" align="right">业务流程编号： </td>
            <td width="26%"><input name="flowId" type="text" value="<c:out value="${dataxFlowVO.id.flowId}"/>"  class="input2" readonly="readonly" /></td>
          </tr>
          <tr>
            <td height="35" align="right">业务流程名称：</td>
            <td height="35"><input name="flowName" id="flowName" type="text"  class="input2" value="<c:out value="${dataxFlowVO.flowName}"/>" maxlength="255"/></td>
            <td height="35" align="right">发起单位平台编号：</td>

            <td height="35"><input name="originateCop" id="originateCop" type="text"  class="input2" value="<c:out value="${dataxFlowVO.originateCop}"/>" maxlength="12" /></td>
          </tr>
          <tr>
            <td height="35" align="right">业务流程备注： </td>
            <td height="35" colspan="3"><textarea name="notes" rows="3"  class="input3" style="width:600px" maxlength="255" ><c:out value="${dataxFlowVO.notes}"/></textarea></td>
          </tr>
        </table>
      </div>

    </div>
    
<div class="content-box">
      <!-- Start Content Box -->
      <div class="content-box-header">
        <h3>节点信息</h3>
        <div class="clear"></div>
      </div>
      <!-- End .content-box-header -->

      <div class="content-box-content">
        <div class="tab-content default-tab">
          <table>
            <thead>
              <tr>
                <th>节点编号</th>
                <th>节点名称</th>
                <th>企业平台编号</th>
                <th>企业平台名称</th>
                <th>服务类型</th>
              </tr>
            </thead>
            <tfoot>
             
            </tfoot>
            <tbody>
            <input type="hidden" id="listSize" name="listSize" value="<c:out value="${listSize}"/>" >
            <c:if test="${isSelect}" >
	             <c:forEach var="dataxFlowActorsTemplateVO" items="${flowActorsTemplateVOList}" varStatus="s" >
	              <tr>
	                <td><c:out value="${dataxFlowActorsTemplateVO.id.actorNo}"></c:out></td>
	                <td><c:out value="${dataxFlowActorsTemplateVO.actorName}"></c:out></td>
	                <td><input id="<c:out value="${s.count}"/>" name="ecCode_<c:out value="${s.count}"/>" type="text" style=" border:1px solid black;"  class="ecCodeInput"  maxlength="12"/></td>
	                <td><div id="ceName_<c:out value="${s.count}"/>" ></div></td>
	                <td> <select id="serviceCode_<c:out value="${s.count}"/>" name="serviceCode_<c:out value="${s.count}"/>" style="border:solid 1px #111"> </select></td>
	                <input type="hidden" id="actorNo_<c:out value="${s.count}"/>" name="actorNo_<c:out value="${s.count}"/>" value="<c:out value="${dataxFlowActorsTemplateVO.id.actorNo}"/>" >
	                <input type="hidden" id="actorName_<c:out value="${s.count}"/>" name="actorName_<c:out value="${s.count}"/>" value="<c:out value="${dataxFlowActorsTemplateVO.actorName}"/>" >
	               
	               
	              </tr>
	              </c:forEach>
              </c:if>
            </tbody>
          </table>
        </div>
        <!-- End #tab1 -->
      </div>
      <!-- End .content-box-content -->
    </div>    

    

  </div>

  <!-- End #main-content -->
</div>
</form>
</body>
</html>
